


<?php
if(isset($_POST["JO_query"])){
	
		if($_POST["JO_query"]=="JO_artist_update"){
			$key=$_POST['JO_chude'];
			$name=$_POST['txtname'];
			$autonym=$_POST['txtautonym'];
			$date = new DateTime($_POST['txtbirth']);
			$birth=$date->format('Y-m-d');
			$nation=$_POST['cbxnation'];
			$p_organ=$_POST['cbxorganization'];
			$content=$_POST['txtcontent'];
			$sex=$_POST['jo_sex'];
			JO_13_update($key,$name,$autonym,$birth,$nation,$p_organ,$content,$sex);
			JO_location();
			
		}
		if($_POST["JO_query"]=="JO_artist_image"){
			$path="./JO_Upload/";
			$key=$_POST['JO_chude'];
			if(isset($_FILES['txtimage']))
			$image=$path.$_FILES['txtimage']['name'];
			else
			$image=$_POST['txtimage'];
			$path="./JO_Upload/";
			if(isset($_FILES['txtimage'])){
			if ($_FILES['txtimage']['name'] != '')//khi nhap lieu, nguoi dung co chon hinh
			{
				if ($_FILES['txtimage']['error'] == " ") //upload ko co loi
				{
					if ($_FILES['txtimage']['size'] < 200000 )
					{
						if(file_exists(	"../JO_Upload/".$_FILES['txtimage']['name'])==false)
						{
							move_uploaded_file($_FILES['txtimage']['tmp_name'], "../JO_Upload/".$_FILES['txtimage']['name']);
						}
					}
				}
			}}
			
			JO_13_image($image,$key);
			JO_location();
			
		}
}
	
	

	/*
	 * ============================================== Get List of Topic ======================================
	 * Author			: Nguyem Hoang Quan
	 * Created Date		: 23/08/2011
	 * Modified Date	: 23/08/2011
	 */

	/*
	 * Get list of Recommendation with name of parent field
	 */
	 function SO_Upload_Image($SO_file,$pathfile){
			$today = gmdate("YmdHis",time()+(7*3600));
			if ((($_FILES[$SO_file]["type"] == "image/gif")
			|| ($_FILES[$SO_file]["type"] == "image/jpeg")
			|| ($_FILES[$SO_file]["type"] == "image/pjpeg"))
			&& ($_FILES[$SO_file]["size"] < 2000000))//2,000,000:2MB
			{
			  if ($_FILES[$SO_file]["error"] > 0)
			  	return 1;
			  else{	
			    if (file_exists("../".$pathfile."/".$_FILES[$SO_file]["name"]))
			    	return 2;
			    else{
			      move_uploaded_file($_FILES[$SO_file]["tmp_name"],$pathfile."/".$today."_".$_FILES[$SO_file]["name"]);
			      return $today."_".$_FILES[$SO_file]["name"];
			    }
			  }
			}
			else
			  return 3;
		}
	  function JO_13_artist_get_searchlist($sea){
		$s_SQLCommand = "call JO_13_artist_get_searchlist('$sea');";
		
		$rs_result = DataProvider::executeSQL($s_SQLCommand);
		return $rs_result; 
	}
	 function JO_13_artist_get_search_pagelist($sea,$vt,$limit){
		$s_SQLCommand = "call JO_13_artist_get_search_pagelist('$sea',$vt,$limit);";
		$rs_result = DataProvider::executeSQL($s_SQLCommand);
		return $rs_result; 
	}
	 function JO_13_get_artist_detail($key){
		$s_SQLCommand = "call JO_13_get_artist_detail($key);";
		$rs_result = DataProvider::executeSQL($s_SQLCommand);
		return $rs_result; 
	}
	 function JO_13_get_organization(){
		$s_SQLCommand = "call JO_13_get_organization();";
		$rs_result = DataProvider::executeSQL($s_SQLCommand);
		return $rs_result; 
	}
	function JO_13_image($image,$key){
		
		
		$s_SQLCommand = "call JO_13_image('$image',$key);";
		
		$rs_result = DataProvider::executeSQL($s_SQLCommand);
		return $rs_result; 
	}
	
	
	
?>